package leetcode.code1232;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public class Solution implements IDebug {

	public boolean checkStraightLine(int[][] coordinates) {
		int len = coordinates.length;
		if (len == 2) {
			return true;
		}
		int a = coordinates[0][0], b = coordinates[0][1];
		for (int i = 2; i < len; i++) {
			int[] cur = coordinates[i];
			int[] last = coordinates[i - 1];
			if ((cur[1] - b) * (last[0] - a) != (cur[0] - a) * (last[1] - b)) {
				return false;
			}
		}
		return true;
	}

	@Override
	public void debug4() {
		HelpDebug.compare(false, this.checkStraightLine(HelpDebug.str2array1("[[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]]")));
		HelpDebug.compare(false, this.checkStraightLine(HelpDebug.str2array1("[[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]]")));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();


	}

}
